import { successResponse, errorResponseSchema } from './common.doc';

export const authDocs = {
    login: {
        post: {
            summary: '登录',
            description: '登录接口',
            tags: ['登录'],
            requestBody: {
                required: true,
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                username: {
                                    type: 'string',
                                    description: '用户名称'
                                },
                                password: {
                                    type: 'string',
                                    description: '用户密码'
                                }
                            }
                        }
                    }
                }
            },
            responses: {
                200: successResponse({
                    type: 'object',
                    properties: {
                        token: {
                            type: 'string',
                            description: '登录令牌'
                        }
                    }
                }),
                500: errorResponseSchema
            }
        }
    },
    register: {
        post: {
            summary: '注册',
            description: '注册接口',
            tags: ['登录'],
            requestBody: {
                required: true,
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                username: {
                                    type: 'string',
                                    description: '用户名称'
                                },
                                password: {
                                    type: 'string',
                                    description: '用户密码'
                                },
                                email: {
                                    type: 'string',
                                    description: '用户邮箱'
                                },
                                code: {
                                    type: 'number',
                                    description: '验证码'
                                }
                            }
                        }
                    }
                }
            },
            responses: {
                200: successResponse({}),
                500: errorResponseSchema
            }
        }
    }
}; 